home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 September / CHIP Eylül 1998.iso / Slackwar / docs / mini / Ultra-DMA < prev    next >
Text File  |  1997-03-17  |  17KB  |  357 lines

  1.   The Linux Ultra-DMA Mini-Howto
  2.   Brion Vibber, brion@pobox.com
  3.   v1.3, 5 March 1998
  4.  
  5.   This document is intended to explain how to use Ultra-DMA aka Ultra-
  6.   ATA aka Ultra33 hard drives and controllers with Linux. The most
  7.   recent version of this mini-Howto can be obtained in HTML format at
  8.   http://pobox.com/~brion/linux/Ultra-DMA.html.
  9.  
  10.   1.  Introduction
  11.  
  12.   This document is intended to explain how to use Ultra-DMA aka Ultra-
  13.   ATA aka Ultra33 hard drives and controllers with Linux. In some cases
  14.   there is no difficulty in using them, but some tweaking can increase
  15.   performance. In other cases, you need to go to extraordinary lengths
  16.   simply to access your hard drives.
  17.  
  18.   1.1.  Disclaimer
  19.  
  20.   The information in this is document is, to the best of my knowledge,
  21.   correct, and should work. However, there may be typos, there may be
  22.   mysterious transmission errors, and there may be strange
  23.   incompatibilities within your own system that prevent the techniques
  24.   described herein from working properly. So... before you go fiddling
  25.   around with you hard drive, BACK UP ANY DATA YOU WANT TO KEEP!
  26.  
  27.   1.2.  Credits
  28.  
  29.   Brion Vibber (brion@pobox.com) - The document itself
  30.  
  31.   Gadi Oxman (gadio@netvision.net.il) - The Promise Ultra33 patch &
  32.   finding the secret numbers for the workaround
  33.  
  34.   John G. (prefect@ipass.net) - VIA VP2 patch & info
  35.  
  36.   Giovanni (giovanni@sudfr.com) - UDMA-enabled VIA-related patch & more
  37.   info
  38.  
  39.   Martin Gaitan - Promise ide0/ide1 workaround
  40.  
  41.   Norman Jacobowitz - Bugged me to add info on the VP3
  42.  
  43.   1.3.  Document History
  44.  
  45.   v1.3, 5 March 1998: VIA VP3 info, better patching instructions,
  46.   pointer to more recent Promise patch.
  47.  
  48.   v1.2, 27 January 1998: Additional Promise workaround info.
  49.  
  50.   v1.1, 21 January 1998: New info about VIA chipset, installing around
  51.   the Promise Ultra33, and enabling Bus Master & UDMA transfer modes.
  52.  
  53.   v1.0, 19 January 1998: More or less complete, first version done in
  54.   SGML.
  55.  
  56.   2.  What is Ultra-DMA and why do I want it?
  57.  
  58.   Here's a brief overview of IDE-based drive technologies:
  59.  
  60.   2.1.  IDE, EIDE, & ATAPI
  61.  
  62.   These are older drive technologies. Most non-SCSI hard drives and
  63.   drive controllers that you can buy today or are likely to be using are
  64.   EIDE, although many of the larger drives now available are UDMA.
  65.  
  66.   2.2.  Bus Master DMA
  67.  
  68.   Bus Master DMA is a technology for increasing the speed of hard disk
  69.   data transfers which requires support from the motherboard and the
  70.   BIOS, and at least some support from the drive.
  71.  
  72.   You can learn more at
  73.   http://developer.intel.com/design/pcisets/busmastr/FAQs.htm.
  74.  
  75.   2.3.  Ultra-DMA aka Ultra-ATA aka Ultra33 aka...
  76.  
  77.   Ultra-DMA has many names, but we'll just call it UDMA in here.
  78.  
  79.   UDMA is a more advanced technology which provides for even faster
  80.   throughput, up to 33.3 MB/s, twice that of EIDE, for much lower prices
  81.   than SCSI. Many new computers come with large UDMA drives and UDMA
  82.   controllers, and it's possible to add a UDMA controller card (such as
  83.   the Promise Ultra33) to an existing system to boost speed, even on
  84.   older non-UDMA drives.
  85.  
  86.   You can learn great details about UDMA at
  87.   http://www.quantum.com/src/whitepapers/ultraata/
  88.  
  89.   3.  Using your UDMA Hard Drive with an EIDE Controller
  90.  
  91.   This is easy to do. Since all UDMA drives are fully EIDE backward-
  92.   compatible, just plunk your drive on your EIDE controller like it was
  93.   any old hard drive & Linux should have no problems detecting or using
  94.   the drive.  However, you will of course be limited to the 16.7 MB/s
  95.   bandwidth of EIDE.
  96.  
  97.   4.  Using your hard drives with a UDMA Controller
  98.  
  99.   Well, there's good news and there's bad news. The good news is that a
  100.   UDMA controller can be used with both UDMA hard drives and legacy EIDE
  101.   hard drives, and will be a lot faster than an EIDE controller. The bad
  102.   news is that they're not technically supported by the current stable
  103.   releases of Linux (2.0.x kernels). In some cases the controllers can
  104.   be used in legacy (EIDE-compatible mode) with no difficulty, in others
  105.   simply using the controller requires a bit of effort. In all cases, in
  106.   order to use UDMA transfer speeds, an appropriate patch is required.
  107.   The following sections will each pertain to a specific type of UDMA
  108.   controller.
  109.  
  110.   5.  The Promise Ultra33 IDE
  111.  
  112.   This is a PCI card that has two UDMA channels on it, supporting up to
  113.   four drives. You can look up specs & pricing & such at
  114.   http://www.promise.com.
  115.  
  116.   This card shipped in early model Gateway 2000 Pentium II systems, and
  117.   may or may not be in more recent models.
  118.  
  119.   The more recent development kernels (current is 2.1.88) have generic
  120.   PCI IDE controller support, which ought to automatically detect the
  121.   Promise Ultra33.  However, the stable kernels (current is 2.0.33)
  122.   require a patch, and it can be a little difficult to get Linux
  123.   installed because of this.
  124.  
  125.   5.1.  Installing Linux with the Promise
  126.  
  127.   Although there is a patch for the Promise controller, it's not very
  128.   easy to apply a patch and recompile your kernel if you haven't
  129.   installed Linux yet! So, here's a workaround which may or may not work
  130.   for you. Thanks to Gadi Oxman for the following information on getting
  131.   the interface settings:
  132.  
  133.        If we can access the console with the installation disk, we can also
  134.        use "cat /proc/pci" to display the Promise interface settings:
  135.  
  136.            RAID bus controller: Promise Technology Unknown device (rev 1).
  137.              Vendor id=105a. Device id=4d33.
  138.              Medium devsel.  IRQ 12.  Master Capable.  Latency=32.
  139.              I/O at 0xe000.   (a)
  140.              I/O at 0xd804.   (b)
  141.              I/O at 0xd400.   (c)
  142.              I/O at 0xd004.   (d)
  143.              I/O at 0xc800.   (e)
  144.  
  145.        and pass "ide2=a,b+2 ide3=c,d+2" as a command line parameter to the kernel.
  146.  
  147.   Note that the numbers probably aren't the same as what you'll have.
  148.   Just as an example, the parameters to use for the above set of numbers
  149.   would be ``ide2=0xe000,0xd806 ide3=0xd400,0xd006''. You may or may not
  150.   also need to include the IRQ, which would make it
  151.   ``ide2=0xe000,0xd806,12 ide3=0xd400,0xd006,12''.  If you're only using
  152.   the first channel on the Promise controller (for instance, if you only
  153.   have one drive, or two if they're master and slave on the same
  154.   channel, on the Promise), then you won't need to specify ide3.
  155.  
  156.   Note that you can definately get to a command prompt and do
  157.   ``cat/proc/pci'' using Red Hat 5.0 or Slackware 3.4; it's almost
  158.   certainly possible with other distributions but I haven't worked with
  159.   them and don't know how.
  160.  
  161.   Under Red Hat 5.0, use the installation boot floppy, and at the boot
  162.   prompt type ``rescue''. It'll load some stuff, prompt you for the
  163.   supplemental disk, ask you about your monitor and keyboard, and
  164.   finally put you into a command prompt. Then, do ``cat /proc/pci'',
  165.   write down the numbers as above, and reboot from the boot disk. This
  166.   time, type ``linux ide2=(this is where you put the numbers like shown
  167.   above) ide3=(more numbers)''. It should now be able to install onto
  168.   your hard disk without difficulty.
  169.  
  170.   Under Slackware 3.4, the process is very similar. Boot with the boot
  171.   disk of your choice, and at the boot prompt, just hit Enter for now.
  172.   It'll load the kernel and prompt for the root disk. Insert the root
  173.   disk, wait for it to load, and log in as root. Do the ``cat
  174.   /proc/pci'' thing and write down those numbers somewhere safe! Reboot
  175.   with the boot floppy and at the boot prompt type ``ramdisk ide2=(this
  176.   is where you put the numbers) ide3=(some more numbers)''. You should
  177.   then be able to install onto your hard disk as normal.
  178.  
  179.   IMPORTANT: Without the patch (discussed in the next section), the
  180.   kernel needs these boot parameters in order to access your hard disk!
  181.   Therefore it is very important that when you configure LILO, either on
  182.   the hard disk or on a boot floppy, that you give it the exact same
  183.   parameters that you gave when installing. Otherwise your system won't
  184.   boot! It should be possible to give them to LILO when you boot (ie,
  185.   press Shift, type in ``linux ide2=.....'' each time you boot), but
  186.   only if you kept the numbers! It is recommended that you patch your
  187.   kernel as soon as possible so you won't have to worry about that
  188.   anymore; once you're booting off a patched kernel, you can get rid of
  189.   the boot parameters.  Also, as far as I know there is no way to pass
  190.   boot parameters to a plain kernel boot floppy (as made with ``make
  191.   zdisk''), you must use LILO or another loader that lets you pass boot
  192.   parameters.
  193.  
  194.   However, unpatched kernels often have a difficult time actually using
  195.   ide2 and ide3, even if the drives are detected properly. So if you
  196.   can't get Linux to install using the above technique, try specifying
  197.   ide0 or ide1 instead of ide2 or ide3 (thanks to Martin Gaitan for this
  198.   technique).  This essentially replaces the on-board controller (if
  199.   any) with the Promise Ultra33 as far as the kernel is concerned, and
  200.   you can follow the directions in the next section as if you had
  201.   physically moved it. Note that if you're using an IDE CD-ROM drive
  202.   connected to your on-board controller to install from, you'll want to
  203.   make sure that you don't take over the controller that the CD is on or
  204.   you won't be able to install! If the CD is hda or hdb, use ide1 for
  205.   your hard drive, and if it's hdc or hdd, then use ide0.
  206.  
  207.   5.2.  Installing Linux Around the Promise
  208.  
  209.   If you can't get the software workaround to work, you'll have to try a
  210.   more brute force approach. Here's an alternative method mthat is
  211.   virtually guaranteed to work, but will require you to open up your
  212.   computer and mess about in it. NOTE: If you are not familiar with the
  213.   process of connecting and disconnecting IDE drives, read the manuals
  214.   that came with your computer, your hard drive, and/or the Promise
  215.   Ultra33 before attempting this! If you screw something up and don't
  216.   know how to put it back, you could end up being sorry!
  217.  
  218.   That being said, it's all really quite simple. Most motherboards these
  219.   days have built-in EIDE controllers. Disconnect your hard drive from
  220.   the Ultra33 and connect it to the onboard controller. If you have
  221.   other IDE devices, such as a CD-ROM, tape, or ZIP drive, on your
  222.   oboard controller, it's easiest if you either add the hard drive on an
  223.   unused channel (the secondary instead of the primary) or temporarily
  224.   displace a device that you don't need immediately (such as ZIP or
  225.   tape). Install Linux. Download and apply the Promise UDMA patch (see
  226.   next section).
  227.  
  228.   Now you're ready to move the drive back onto the Promise... almost. To
  229.   be safe, make a kernel-image boot floppy (cd /usr/src/linux ; make
  230.   zdisk), which you will be able to use to boot your system in case LILO
  231.   doesn't work. Actually, to be very safe, make two and put one away for
  232.   now.
  233.  
  234.   Okay, now it's time to think a little... if you have just one hard
  235.   drive and it's going to be on the Promise, then it will most likely be
  236.   /dev/hde (a and b are for the primary onboard controller, c and d for
  237.   the secondary onboard controller). If you're going to put any other
  238.   drives on it, then the slave of the Promise's first channel will be
  239.   /dev/hdf, the master of the second will be /dev/hdg, and the slave of
  240.   the second will be /dev/hdh.
  241.  
  242.   Edit /etc/fstab, and change all the partitions of the hard drives
  243.   you're moving from the onboard drives (/dev/hda, hdb, etc) to their
  244.   new locations on the Promise (/dev/hde, hdf, etc). If you had to
  245.   displace any devices (such as a CD-ROM or ZIP drive) that you want to
  246.   leave on the onboard controller, then change them to their new
  247.   locations as well. For instance, if your CD-ROM was originally the
  248.   master on the primary channel (/dev/hda), but you put your hard disk
  249.   there and had to bump the CD to the slave (/dev/hdb) or to the
  250.   secondary channel (/dev/hdc), and now you want to put it back, then
  251.   change it to /dev/hda.
  252.  
  253.   If you're using LILO, reconfigure LILO to use the new location of the
  254.   drive (LILO configuration is beyond the scope of this document, if you
  255.   don't know how, read the LILO mini-HOWTO
  256.   <http://sunsite.unc.edu/LDP/HOWTO/mini/LILO.html>), or else it
  257.   probably won't be able to boot unless you use that boot floppy I had
  258.   you make, which you will also want to configure to boot off the new
  259.   partition. This is done using the rdev command. Put the floppy in the
  260.   drive and type ``rdev /dev/fd0 /dev/hde1''. Of course that's assuming
  261.   your root partition is the first on your first UDMA drive. If not
  262.   (mine is /dev/hde7, for instance), then obviously use the appropriate
  263.   partition number!
  264.  
  265.   Reboot. Your system should now work fine.
  266.  
  267.   5.3.  Patching for the Promise
  268.  
  269.   There is a kernel patch available for the Promise Ultra33, written by
  270.   Gadi Oxman (gadio@netvision.net.il).
  271.  
  272.   The current version of the patch works on kernel version 2.0.33 and
  273.   can be obtained from Linux Mama
  274.   <http://www.huwig.de/linux/mama/20-newdriver.html>.  Note that you
  275.   will need to use bzip2 <http://www.muraroa.demon.co.uk/> to decompress
  276.   this patch rather than gzip.
  277.  
  278.   You can also download a version of the patch for kernel 2.0.30,
  279.   compressed with gzip, from
  280.   http://pobox.com/~brion/linux/promise_update.gz. This version will
  281.   work on 2.0.33 but will result in ``unknown PCI device'' messages
  282.   because of a change in pci.c between 2.0.30 and 2.0.33.
  283.  
  284.   For instructions on how to patch and compile the kernel, make sure you
  285.   have the kernel source and gcc installed and read
  286.   /usr/src/linux/README.
  287.  
  288.   Wondering why you should bother with the patch, aside from saving
  289.   yourself the trouble of the boot parameters from the workaround? Well,
  290.   according to the author:
  291.  
  292.   One advantage of using the kernel patch is that we will be able to use
  293.   bus mastering DMA transfers ("hdparm -d1 /dev/hdx") in case the triton
  294.   driver is compiled into the kernel.
  295.  
  296.   In other words, you'll not only be able to use your hard drive, you'll
  297.   be able to use it at the high speeds that UDMA is supposed to bring!
  298.  
  299.   6.  Intel TX motherboard onboard UDMA controller
  300.  
  301.   Thanks again to Gadi for this info:
  302.  
  303.          Bus mastering DMA support for the Intel TX chipset is available in 2.0.31
  304.          and above.
  305.  
  306.   In older kernels (such as Slackware 3.4's 2.0.30), the controller will
  307.   be used in the slower EIDE mode.  In either case the controller will
  308.   be automatically detected by the kernel and you should have no trouble
  309.   using it.
  310.  
  311.   As far as I know there is not a patch to enable full UDMA transfers,
  312.   but having Bus Mastering is still better than not.
  313.  
  314.   7.  The VIA VPx and Related Chipsets
  315.  
  316.   This controller also can be autodetected and used in EIDE mode by an
  317.   unpatched kernel, but if you've got one of these, you'll want to grab
  318.   a patch so you can get faster throughput and do away with annoying
  319.   "unkown PCI device" messages.
  320.  
  321.   One is available at http://www.ipass.net/~prefect/; it is designed for
  322.   the VIA VP2/97 chipset, found on FIC's PA-2007 and PA-2011
  323.   motherboards, but may work on related chipsets.  It has been reported
  324.   that it functions on the newer VIA VP3 chipset, your mileage may vary.
  325.  
  326.   Note that this patch only supports Bus Mastering mode, not full UDMA
  327.   mode, but it's still better than plain-vanilla EIDE mode.  Follow the
  328.   directions at the patch's site for enabling BMDMA mode.
  329.  
  330.   There is another patch that supports full UDMA mode at
  331.   http://www.pyreneesweb.com/Udma/udma.html, designed for the VIA
  332.   VT82C586B, and it ought to work on the VP2, VP3, VPX, P6 and AGP
  333.   Apollo chipsets. Follow the directions for installation and UDMA
  334.   enabling there, but it is recommended that you back up any data you
  335.   want to keep, as there are potential problems with incompatible
  336.   motherboards. But, if it does work, it should work without problems.
  337.  
  338.   8.  If you still can't get it to work!
  339.  
  340.   If nothing in this document proved helpful, or at least not helpful
  341.   enough to get your machine working, your best bet is to write up a
  342.   message that fully describes your difficulty, what type of UDMA
  343.   controller you have, whether it's onboard or on a card, if your drive
  344.   is actually UDMA or plain EIDE, exactly what configuration of drives
  345.   you have, what version (distribution & kernel versions if possible) of
  346.   Linux you're using, and anything else that sounds useful, and post it
  347.   to the newsgroup comp.os.linux.hardware.  You'll probably get some
  348.   helpful suggestions soon.
  349.  
  350.   9.  If you have some information about UDMA stuff that's not in this
  351.   mini-howto...
  352.  
  353.   Great! If you know something I don't, by all means send it to me
  354.   (brion@pobox.com) and I'll put it in this document and update it
  355.   fairly soon.
  356.  
  357.